home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
- Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
- Begin VB.Form frmBooks
- BorderStyle = 1 'Fixed Single
- Caption = "Books Database"
- ClientHeight = 3345
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 6165
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 3345
- ScaleWidth = 6165
- StartUpPosition = 3 'Windows Default
- Begin MSAdodcLib.Adodc datBooks
- Height = 375
- Left = 3000
- Top = 2880
- Width = 3135
- _ExtentX = 5530
- _ExtentY = 661
- ConnectMode = 0
- CursorLocation = 3
- IsolationLevel = -1
- ConnectionTimeout= 15
- CommandTimeout = 30
- CursorType = 3
- LockType = 3
- CommandType = 8
- CursorOptions = 0
- CacheSize = 50
- MaxRecords = 0
- BOFAction = 0
- EOFAction = 0
- ConnectStringType= 1
- Appearance = 1
- BackColor = -2147483643
- ForeColor = -2147483640
- Orientation = 0
- Enabled = -1
- Connect = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=C:\VBDB\Working\Biblio.mdb"
- OLEDBString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=C:\VBDB\Working\Biblio.mdb"
- OLEDBFile = ""
- DataSourceName = ""
- OtherAttributes = ""
- UserName = ""
- Password = ""
- RecordSource = ""
- Caption = "Books"
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- _Version = 393216
- End
- Begin MSDataGridLib.DataGrid grdBooks
- Bindings = "Example5-2AD.frx":0000
- Height = 2175
- Left = 120
- TabIndex = 2
- Top = 120
- Width = 5895
- _ExtentX = 10398
- _ExtentY = 3836
- _Version = 393216
- HeadLines = 1
- RowHeight = 15
- BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ColumnCount = 2
- BeginProperty Column00
- DataField = ""
- Caption = ""
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 1033
- SubFormatType = 0
- EndProperty
- EndProperty
- BeginProperty Column01
- DataField = ""
- Caption = ""
- BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
- Type = 0
- Format = ""
- HaveTrueFalseNull= 0
- FirstDayOfWeek = 0
- FirstWeekOfYear = 0
- LCID = 1033
- SubFormatType = 0
- EndProperty
- EndProperty
- SplitCount = 1
- BeginProperty Split0
- BeginProperty Column00
- EndProperty
- BeginProperty Column01
- EndProperty
- EndProperty
- End
- Begin VB.CommandButton cmdAll
- Caption = "Show All Records"
- Height = 375
- Left = 120
- TabIndex = 1
- Top = 2880
- Width = 2775
- End
- Begin VB.CommandButton cmdLetter
- Caption = "A"
- Height = 375
- Index = 0
- Left = 120
- TabIndex = 0
- Top = 2400
- Width = 1455
- End
- Attribute VB_Name = "frmBooks"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Dim SQLAll As String
- Private Sub cmdAll_Click()
- 'Show all records
- datBooks.RecordSource = SQLAll + "ORDER BY Authors.Author"
- datBooks.Refresh
- End Sub
- Private Sub cmdLetter_Click(Index As Integer)
- If Index <> 25 Then
- 'Key other than Z clicked
- 'Append to SQLAll to limit records to letter clicked
- datBooks.RecordSource = SQLAll + "AND Authors.Author > '" + cmdLetter(Index).Caption + " ' "
- datBooks.RecordSource = datBooks.RecordSource + "AND Authors.Author < '" + cmdLetter(Index + 1).Caption + " ' "
- 'Z Clicked
- 'Append to SQLAll to limit records to Z Authors
- datBooks.RecordSource = SQLAll + "AND Authors.Author > 'Z' "
- End If
- datBooks.RecordSource = datBooks.RecordSource + "ORDER BY Authors.Author"
- datBooks.Refresh
- End Sub
- Private Sub Form_Activate()
- 'Show all records initially
- Call cmdAll_Click
- End Sub
- Private Sub Form_Load()
- Dim I As Integer
- 'Size search buttons
- cmdLetter(0).Width = (frmBooks.ScaleWidth - 2 * cmdLetter(0).Left) / 26
- 'Create 25 new buttons
- 'Position new button next to prior button
- For I = 1 To 25
- Load cmdLetter(I)
- cmdLetter(I).Left = cmdLetter(I - 1).Left + cmdLetter(0).Width
- cmdLetter(I).Caption = Chr(Asc("A") + I)
- cmdLetter(I).Visible = True
- Next I
- 'Build basic SQL statement
- SQLAll = "SELECT Authors.Author,Titles.Title,Publishers.[Company Name] "
- SQLAll = SQLAll + "FROM Authors, Titles, Publishers, [Title Author] "
- SQLAll = SQLAll + "WHERE Titles.ISBN = [Title Author].ISBN "
- SQLAll = SQLAll + "AND Authors.Au_ID = [Title Author].Au_ID "
- SQLAll = SQLAll + "AND Titles.PubID = Publishers.PubID "
- End Sub
-